package annotation;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author： pang-yun
 * @date： 2021-12-01 14:10
 * 功能目的 ：用于
 */

public class Test {
    public static void main(String[] args) {
        // 从 xml 中读取到配置文件  开启注解扫描
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("annotation.xml");
        // 拿到 user
//        User user = context.getBean("user", User.class);
//        System.out.println(user);


//        UserDaoImpl userDaoImpl = context.getBean("userDaoImpl", UserDaoImpl.class);
//        userDaoImpl.print();

        //使用配置类来实现
        AnnotationConfigApplicationContext annotation = new AnnotationConfigApplicationContext("annotation");
        UseA userA = annotation.getBean("userA", UseA.class);
        userA.userName();


    }
}
